 #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#define N 40
int Readscore(int score[], long num[]);
int Linscore(long num, long x, int n);
int main()
{
	int score[N], n, pos;
	long num[N], x;
	n = Readscore(score, num);
	printf("The total students are %d\n", n);
	printf("Input the searching ID:");
	scanf("%ld", &x);
	pos = Linscore(num, x, n);
	if (pos != -1)
		printf("score=%d\n", score[pos]);
	else
		printf("Not found!");
	return 0;
}

int Readscore(int score[], long num[])
{
	int i = -1;
	do {
		i++;
		printf("Input the students'ID and score:");
		scanf("%ld%d", &num[i], &score[i]);
	} while (num[i] > 0&&score[i] >= 0);
   
	return i;
}

int Linscore(long num[], long x, int n)
{
	for (int i = 0; i < n; i++)
	{
		if (num[i] == x)
			return i;
	}
	return -1;
}